/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.javanile.me.chessengine;

/**
 *
 * @author acer
 */
public class Match {
	private Engine w;
	private Engine b;
	private int l;
	private String m;
	private int t;
	
	public Match(Engine white, Engine black) {
		w = white;
		b = black;
		l = -1;
		t = 1;
		m = "";
	}
	
	public boolean next() {
		l++;
		return l<20;
	}
	
	public void doMove(String move) {
		if (t>0) {
			m+=(((l+1)))+". "+move+" ";
		} else {
			m+=move+"\n";
		}
		t = -t;
		w.doMove(move);
		b.doMove(move);
	}
	
	public Engine getWhite() {
		return w;
	}
	
	public Engine getBlack() {
		return b;
	}
	
	public void dump() {		
		System.out.println(m);
		w.dump();
	}
}
